import React from "react";

function Card(props) {
  const num = "Card";
  return (
    <div>
      <p>Card</p>
      {props.children(num)}
    </div>
  );
}

class App extends React.Component {
  render() {
    const num = "App";

    return (
      <div>
        <h1>App</h1>

        <Card>{(num) => <h1>插槽内容 {num}</h1>}</Card>
      </div>
    );
  }
}

export default App;
